package com.spring.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * ClassName: EventPublisher
 * Description: 事件发布者
 * Date: 2017/5/11 20:32
 *
 * @author SAM SHO
 * @version V1.0
 */
@Component
public class EventPublisher {
    @Autowired
    ApplicationContext applicationContext;

    public void publish(String msg) {
        EventBean eventBean = new EventBean(this, msg);
        applicationContext.publishEvent(eventBean);
    }
}
